<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.2.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <meta name="google-site-verification" content="kYQuniuaRZuL9fq0DATfL7extAwcqWG6Ki286ZMcpak">
  <meta name="baidu-site-verification" content="code-MRqS7DOO9x">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"blogwxb.cn","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.11.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":true,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":"gitalk","storage":true,"lazyload":false,"nav":null,"activeClass":"gitalk"},"stickytabs":false,"motion":{"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="一、混合模式在ps中有很多的混合模式，如：正片叠底、滤色、变暗、变亮等等。下图为ps的算法公式图：">
<meta property="og:type" content="article">
<meta property="og:title" content="webgl实现ps混合模式第一章~正片叠底、滤色">
<meta property="og:url" content="https://blogwxb.cn/webgl%E5%AE%9E%E7%8E%B0ps%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%B8%80%E7%AB%A0-%E6%AD%A3%E7%89%87%E5%8F%A0%E5%BA%95%E3%80%81%E6%BB%A4%E8%89%B2/index.html">
<meta property="og:site_name" content="会飞的猪9527">
<meta property="og:description" content="一、混合模式在ps中有很多的混合模式，如：正片叠底、滤色、变暗、变亮等等。下图为ps的算法公式图：">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-0.png">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-1.png">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-2.png">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-3.png">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-4.png">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-5.png">
<meta property="og:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-6.png">
<meta property="article:published_time" content="2022-08-18T02:24:34.000Z">
<meta property="article:modified_time" content="2022-10-07T15:14:02.083Z">
<meta property="article:author" content="wxb">
<meta property="article:tag" content="WebGl">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-0.png">


<link rel="canonical" href="https://blogwxb.cn/webgl%E5%AE%9E%E7%8E%B0ps%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%B8%80%E7%AB%A0-%E6%AD%A3%E7%89%87%E5%8F%A0%E5%BA%95%E3%80%81%E6%BB%A4%E8%89%B2/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://blogwxb.cn/webgl%E5%AE%9E%E7%8E%B0ps%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%B8%80%E7%AB%A0-%E6%AD%A3%E7%89%87%E5%8F%A0%E5%BA%95%E3%80%81%E6%BB%A4%E8%89%B2/","path":"webgl实现ps混合模式第一章-正片叠底、滤色/","title":"webgl实现ps混合模式第一章~正片叠底、滤色"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>webgl实现ps混合模式第一章~正片叠底、滤色 | 会飞的猪9527</title>
  





  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
  <!-- Google Analytics -->
  <script>
  window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  ga('create', 'UA-XXXXX-Y', 'auto');
  ga('send', 'pageview');
  </script>
  <script async src='https://www.google-analytics.com/analytics.js'></script>
  <!-- End Google Analytics -->

  <!-- Baidu Analytics -->
  <script async src = 'https://zz.bdstatic.com/linksubmit/push.js'></script>
  <!-- End Baidu Analytics -->

<link rel="alternate" href="/atom.xml" title="会飞的猪9527" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">会飞的猪9527</p>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">32</span></a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">5</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">91</span></a></li><li class="menu-item menu-item-commonweal"><a href="/404" rel="section"><i class="fa fa-heartbeat fa-fw"></i>公益 404</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F"><span class="nav-number">1.</span> <span class="nav-text">一、混合模式</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E4%BB%80%E4%B9%88%E6%98%AF%E6%AD%A3%E7%89%87%E5%8F%A0%E5%BA%95%E5%92%8C%E6%BB%A4%E8%89%B2"><span class="nav-number">2.</span> <span class="nav-text">二、什么是正片叠底和滤色</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E6%AD%A3%E7%89%87%E5%8F%A0%E5%BA%95%E5%AE%9E%E7%8E%B0%E8%BF%87%E7%A8%8B"><span class="nav-number">3.</span> <span class="nav-text">三、正片叠底实现过程</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%BA%E4%BB%80%E4%B9%88%E5%91%A2%EF%BC%9F"><span class="nav-number">3.0.1.</span> <span class="nav-text">为什么呢？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%80%8E%E4%B9%88%E6%98%BE%E7%A4%BA%E5%87%BA%E6%9D%A5%E4%B8%8B%E9%9D%A2%E7%9A%84%E5%9B%BE%E7%89%87%EF%BC%9F"><span class="nav-number">3.0.2.</span> <span class="nav-text">怎么显示出来下面的图片？</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%BB%A4%E8%89%B2%E5%AE%9E%E7%8E%B0%E8%BF%87%E7%A8%8B"><span class="nav-number">4.</span> <span class="nav-text">滤色实现过程</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="wxb"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">wxb</p>
  <div class="site-description" itemprop="description">主要是分享自己在Web前端的一些入的坑，脱的坑的经历，也会是分享一些Node后端的知识。</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">91</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">5</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">32</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/dearDreamWeb" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;dearDreamWeb" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>


  <div class="links-of-blogroll site-overview-item animated">
    <div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i>
      推荐
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://www.ruanyifeng.com/blog/" title="https:&#x2F;&#x2F;www.ruanyifeng.com&#x2F;blog&#x2F;" rel="noopener" target="_blank">阮一峰的网络日志</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://nav.blogwxb.cn/" title="https:&#x2F;&#x2F;nav.blogwxb.cn&#x2F;" rel="noopener" target="_blank">轩辕导航</a>
        </li>
    </ul>
  </div>

        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/dearDreamWeb" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://blogwxb.cn/webgl%E5%AE%9E%E7%8E%B0ps%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%B8%80%E7%AB%A0-%E6%AD%A3%E7%89%87%E5%8F%A0%E5%BA%95%E3%80%81%E6%BB%A4%E8%89%B2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="wxb">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="会飞的猪9527">
      <meta itemprop="description" content="主要是分享自己在Web前端的一些入的坑，脱的坑的经历，也会是分享一些Node后端的知识。">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="webgl实现ps混合模式第一章~正片叠底、滤色 | 会飞的猪9527">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          webgl实现ps混合模式第一章~正片叠底、滤色
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2022-08-18 10:24:34" itemprop="dateCreated datePublished" datetime="2022-08-18T10:24:34+08:00">2022-08-18</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2022-10-07 23:14:02" itemprop="dateModified" datetime="2022-10-07T23:14:02+08:00">2022-10-07</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <!-- <span id="busuanzi_value_page_pv"></span> -->
      <span id="views_text"></span>
    </span>
</div>


        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="一、混合模式"><a href="#一、混合模式" class="headerlink" title="一、混合模式"></a>一、混合模式</h1><p>在ps中有很多的混合模式，如：正片叠底、滤色、变暗、变亮等等。下图为ps的算法公式图：<br><img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-0.png" height="400/"></p>
<span id="more"></span>
<h1 id="二、什么是正片叠底和滤色"><a href="#二、什么是正片叠底和滤色" class="headerlink" title="二、什么是正片叠底和滤色"></a>二、什么是正片叠底和滤色</h1><p>正片叠底简单的来说就是<code>“去白留黑”</code>，所谓的<code>“去白留黑”</code>的实现原理就是将两张图的<code>rgba相乘</code>，rgba的各个值的区间为<code>[0.0,1.0]</code>，1.0乘任何值还是任何值本身，所以白色就被去除掉了。<br>滤色和正片叠底是相反的，也就是<code>“去黑留白”</code>。</p>
<h1 id="三、正片叠底实现过程"><a href="#三、正片叠底实现过程" class="headerlink" title="三、正片叠底实现过程"></a>三、正片叠底实现过程</h1><p>下面例子中的两张图片原图为下面两个，第一张是效果图中的底图，第二张图是实现叠加效果的上层的图片</p>
<div style="display:flex">
    <img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-1.png" height="200/">
    <img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-2.png" height="200/">
</div>

<p>这两个图片混合模式的顶点着色器都是一样的。<br>例子：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">const</span> VSHADER_SOURCE = `</span><br><span class="line">    attribute vec2 a_Position;    <span class="comment">// 顶点坐标</span></span><br><span class="line">    attribute vec2 a_PointUV;     <span class="comment">// 顶点UV</span></span><br><span class="line">    varying vec2 v_PointUV;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="type">void</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">        gl_Position = <span class="built_in">vec4</span>(a_Position,<span class="number">0.0</span>,<span class="number">1.0</span>);</span><br><span class="line">        v_PointUV = a_PointUV;</span><br><span class="line">    &#125;</span><br><span class="line">`;</span><br></pre></td></tr></table></figure>
<p>正片叠底的片元着色器为：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">const</span> FSHADER_SOURCE = `</span><br><span class="line">    precision mediump <span class="type">float</span>;</span><br><span class="line">    varying vec2 v_PointUV;</span><br><span class="line">    uniform sampler2D u_Image;</span><br><span class="line">    uniform sampler2D u_Image1;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="type">void</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        vec4 baseColor = <span class="built_in">texture2D</span>(u_Image, v_PointUV);</span><br><span class="line">        vec4 blendColor = <span class="built_in">texture2D</span>(u_Image1, v_PointUV);</span><br><span class="line">        gl_FragColor = blendColor * baseColor;</span><br><span class="line">    &#125;</span><br><span class="line">`;</span><br></pre></td></tr></table></figure>
<p>运行结果：<br><img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-3.png" height="200/"><br>这种两张都没有透明的部分的图片正片叠底的效果是没错的，但是，当混合模式的<code>图片部分有透明</code>的话就会导致下层的图片显示不出来，如下图：<br><img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-4.png" height="200/"></p>
<p>可以看的出来除了人物正片叠底了，人物之外透明部分是没有混合显示出来的。</p>
<h3 id="为什么呢？"><a href="#为什么呢？" class="headerlink" title="为什么呢？"></a>为什么呢？</h3><p>因为透明部分的<code>alpha值</code>是<code>0.0</code>，也就是rgba中的a是0.0，任何值乘以0.0都是0.0，所以下面的图片也就不显示了。</p>
<h3 id="怎么显示出来下面的图片？"><a href="#怎么显示出来下面的图片？" class="headerlink" title="怎么显示出来下面的图片？"></a>怎么显示出来下面的图片？</h3><p>判断上层图片的alpha值是否为0.0，若为0.0时，就显示下层图片的颜色值。改良过的片元着色器如下：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">const</span> FSHADER_SOURCE = `</span><br><span class="line">    precision mediump <span class="type">float</span>;</span><br><span class="line">    varying vec2 v_PointUV;</span><br><span class="line">    uniform sampler2D u_Image;</span><br><span class="line">    uniform sampler2D u_Image1;</span><br><span class="line">    <span class="function"><span class="type">void</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 底层图片颜色</span></span><br><span class="line">        vec4 baseColor = <span class="built_in">texture2D</span>(u_Image, v_PointUV);</span><br><span class="line">        <span class="comment">// 上层混合图片的颜色</span></span><br><span class="line">        vec4 blendColor = <span class="built_in">texture2D</span>(u_Image1, v_PointUV);</span><br><span class="line">        vec4 color = blendColor * baseColor + blendColor * (<span class="number">1.0</span> - baseColor.a) + baseColor * (<span class="number">1.0</span> - blendColor.a);</span><br><span class="line">        <span class="keyword">if</span>(blendColor.a == <span class="number">0.0</span>)&#123;</span><br><span class="line">            color = baseColor;</span><br><span class="line">        &#125;</span><br><span class="line">        gl_FragColor = color;</span><br><span class="line">    &#125;</span><br><span class="line">`;</span><br></pre></td></tr></table></figure>
<p>效果图如下：<br><img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-5.png" height="200/"></p>
<h1 id="滤色实现过程"><a href="#滤色实现过程" class="headerlink" title="滤色实现过程"></a>滤色实现过程</h1><p>滤色的片元着色器为：</p>
<figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">const</span> FSHADER_SOURCE = `</span><br><span class="line">    precision mediump <span class="type">float</span>;</span><br><span class="line">    varying vec2 v_PointUV;</span><br><span class="line">    uniform sampler2D u_Image;</span><br><span class="line">    uniform sampler2D u_Image1;</span><br><span class="line">    <span class="function"><span class="type">void</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 底层图片颜色</span></span><br><span class="line">        vec4 baseColor = <span class="built_in">texture2D</span>(u_Image, v_PointUV);</span><br><span class="line">        <span class="comment">// 上层混合图片的颜色</span></span><br><span class="line">        vec4 blendColor = <span class="built_in">texture2D</span>(u_Image1, v_PointUV);</span><br><span class="line">        vec4 color = <span class="built_in">vec4</span>(<span class="number">1.0</span>)-((<span class="built_in">vec4</span>(<span class="number">1.0</span>)-blendColor)*(<span class="built_in">vec4</span>(<span class="number">1.0</span>)-baseColor));</span><br><span class="line">        <span class="keyword">if</span>(blendColor.a == <span class="number">0.0</span>)&#123;</span><br><span class="line">            color = baseColor;</span><br><span class="line">        &#125;</span><br><span class="line">        gl_FragColor = color;</span><br><span class="line">    &#125;</span><br><span class="line">`;</span><br></pre></td></tr></table></figure>
<img data-src="https://lire.oss-cn-hangzhou.aliyuncs.com/7f352606-e5b7-4a89-a02c-7e2b8d818148-6.png" height="200/">

<p>正片叠底完整代码片段：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> textureList = [];  </span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> <span class="variable constant_">VSHADER_SOURCE</span> = <span class="string">`</span></span><br><span class="line"><span class="string">    attribute vec2 a_Position;    // 顶点坐标</span></span><br><span class="line"><span class="string">    attribute vec2 a_PointUV;     // 顶点UV</span></span><br><span class="line"><span class="string">    varying vec2 v_PointUV;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    void main()&#123;</span></span><br><span class="line"><span class="string">        gl_Position = vec4(a_Position,0.0,1.0);</span></span><br><span class="line"><span class="string">        v_PointUV = a_PointUV;</span></span><br><span class="line"><span class="string">    &#125;</span></span><br><span class="line"><span class="string">`</span>;</span><br><span class="line"><span class="keyword">const</span> <span class="variable constant_">FSHADER_SOURCE</span> = <span class="string">`</span></span><br><span class="line"><span class="string">    precision mediump float;</span></span><br><span class="line"><span class="string">    varying vec2 v_PointUV;</span></span><br><span class="line"><span class="string">    uniform sampler2D u_Image;</span></span><br><span class="line"><span class="string">    uniform sampler2D u_Image1;</span></span><br><span class="line"><span class="string">    void main() &#123;</span></span><br><span class="line"><span class="string">        // 底层图片颜色</span></span><br><span class="line"><span class="string">        vec4 baseColor = texture2D(u_Image, v_PointUV);</span></span><br><span class="line"><span class="string">        // 上层混合图片的颜色</span></span><br><span class="line"><span class="string">        vec4 blendColor = texture2D(u_Image1, v_PointUV);</span></span><br><span class="line"><span class="string">        vec4 color = blendColor * baseColor;</span></span><br><span class="line"><span class="string">        if(blendColor.a == 0.0)&#123;</span></span><br><span class="line"><span class="string">            color = baseColor;</span></span><br><span class="line"><span class="string">        &#125;</span></span><br><span class="line"><span class="string">        gl_FragColor = color;</span></span><br><span class="line"><span class="string">    &#125;</span></span><br><span class="line"><span class="string">`</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> vShader = gl.<span class="title function_">createShader</span>(gl.<span class="property">VERTEX_SHADER</span>);</span><br><span class="line">gl.<span class="title function_">shaderSource</span>(vShader, <span class="variable constant_">VSHADER_SOURCE</span>);</span><br><span class="line">gl.<span class="title function_">compileShader</span>(vShader);</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> fShader = gl.<span class="title function_">createShader</span>(gl.<span class="property">FRAGMENT_SHADER</span>);</span><br><span class="line">gl.<span class="title function_">shaderSource</span>(fShader, <span class="variable constant_">FSHADER_SOURCE</span>);</span><br><span class="line">gl.<span class="title function_">compileShader</span>(fShader);</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> program = gl.<span class="title function_">createProgram</span>()</span><br><span class="line">gl.<span class="title function_">attachShader</span>(program, vShader) <span class="comment">// 添加顶点着色器</span></span><br><span class="line">gl.<span class="title function_">attachShader</span>(program, fShader) <span class="comment">// 添加片元着色器</span></span><br><span class="line">gl.<span class="title function_">linkProgram</span>(program) <span class="comment">// 连接 program 中的着色器</span></span><br><span class="line"></span><br><span class="line">gl.<span class="title function_">useProgram</span>(program) <span class="comment">// 告诉 WebGL 用这个 program 进行渲染</span></span><br><span class="line"><span class="keyword">const</span> bufferId = gl.<span class="title function_">createBuffer</span>();</span><br><span class="line">gl.<span class="title function_">bindBuffer</span>(gl.<span class="property">ARRAY_BUFFER</span>, bufferId);</span><br><span class="line"></span><br><span class="line"><span class="title function_">draw</span>()</span><br><span class="line"></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">random</span>(<span class="params">min, max</span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> min + <span class="title class_">Math</span>.<span class="title function_">random</span>() * (max - min);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">async</span> <span class="keyword">function</span> <span class="title function_">draw</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">let</span> data = [</span><br><span class="line">        -<span class="number">1</span>, -<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>,</span><br><span class="line">        <span class="number">1</span>, -<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>,</span><br><span class="line">        <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>,</span><br><span class="line">        <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>,</span><br><span class="line">        -<span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">1</span>,</span><br><span class="line">        -<span class="number">1</span>, -<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>,</span><br><span class="line">    ];</span><br><span class="line">    data = <span class="keyword">new</span> <span class="title class_">Float32Array</span>(data)</span><br><span class="line">    <span class="keyword">await</span> <span class="title function_">loadTextureImage</span>(<span class="number">0</span>, <span class="string">&#x27;./images/1.jpeg&#x27;</span>)</span><br><span class="line">    <span class="keyword">await</span> <span class="title function_">loadTextureImage</span>(<span class="number">1</span>, <span class="string">&#x27;./images/0.jpeg&#x27;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> <span class="variable constant_">FSIZE</span> = data.<span class="property">BYTES_PER_ELEMENT</span>;</span><br><span class="line"></span><br><span class="line">    gl.<span class="title function_">bufferData</span>(gl.<span class="property">ARRAY_BUFFER</span>, data, gl.<span class="property">STATIC_DRAW</span>);</span><br><span class="line">    <span class="keyword">const</span> a_Position = gl.<span class="title function_">getAttribLocation</span>(program, <span class="string">&#x27;a_Position&#x27;</span>);</span><br><span class="line">    gl.<span class="title function_">vertexAttribPointer</span>(a_Position, <span class="number">2</span>, gl.<span class="property">FLOAT</span>, <span class="literal">false</span>, <span class="variable constant_">FSIZE</span> * <span class="number">4</span>, <span class="number">0</span>);</span><br><span class="line">    gl.<span class="title function_">enableVertexAttribArray</span>(a_Position);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> a_PointUV = gl.<span class="title function_">getAttribLocation</span>(program, <span class="string">&#x27;a_PointUV&#x27;</span>);</span><br><span class="line">    gl.<span class="title function_">vertexAttribPointer</span>(a_PointUV, <span class="number">2</span>, gl.<span class="property">FLOAT</span>, <span class="literal">false</span>, <span class="variable constant_">FSIZE</span> * <span class="number">4</span>, <span class="variable constant_">FSIZE</span> * <span class="number">2</span>);</span><br><span class="line">    gl.<span class="title function_">enableVertexAttribArray</span>(a_PointUV);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> u_Image = gl.<span class="title function_">getUniformLocation</span>(program, <span class="string">&quot;u_Image&quot;</span>);</span><br><span class="line">    gl.<span class="title function_">activeTexture</span>(gl.<span class="property">TEXTURE0</span> + <span class="number">0</span>);</span><br><span class="line">    gl.<span class="title function_">bindTexture</span>(gl.<span class="property">TEXTURE_2D</span>, textureList[<span class="number">0</span>]);</span><br><span class="line">    gl.<span class="title function_">uniform1i</span>(u_Image, <span class="number">0</span>);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> u_Image1 = gl.<span class="title function_">getUniformLocation</span>(program, <span class="string">&quot;u_Image1&quot;</span>);</span><br><span class="line">    gl.<span class="title function_">activeTexture</span>(gl.<span class="property">TEXTURE0</span> + <span class="number">1</span>);</span><br><span class="line">    gl.<span class="title function_">bindTexture</span>(gl.<span class="property">TEXTURE_2D</span>, textureList[<span class="number">1</span>]);</span><br><span class="line">    gl.<span class="title function_">uniform1i</span>(u_Image1, <span class="number">1</span>);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> u_TranslateImage = gl.<span class="title function_">getUniformLocation</span>(program, <span class="string">&quot;u_TranslateImage&quot;</span>);</span><br><span class="line">    gl.<span class="title function_">uniform1f</span>(u_TranslateImage, translateNumber);</span><br><span class="line"></span><br><span class="line">    gl.<span class="title function_">clearColor</span>(<span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>, <span class="number">1.0</span>);</span><br><span class="line">    gl.<span class="title function_">clear</span>(gl.<span class="property">COLOR_BUFFER_BIT</span>);</span><br><span class="line">    gl.<span class="title function_">drawArrays</span>(gl.<span class="property">TRIANGLES</span>, <span class="number">0</span>, data.<span class="property">length</span> / <span class="number">4</span>)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 判断是否是 2 的 整数次方</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">isPowerOf2</span>(<span class="params">value</span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> (value &amp; (value - <span class="number">1</span>)) === <span class="number">0</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment">    * 加载纹理</span></span><br><span class="line"><span class="comment">    */</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">loadTextureImage</span>(<span class="params">index, url</span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="title class_">Promise</span>(<span class="function">(<span class="params">resolve</span>) =&gt;</span> &#123;</span><br><span class="line">        <span class="keyword">const</span> img = <span class="keyword">new</span> <span class="title class_">Image</span>();</span><br><span class="line">        img.<span class="property">src</span> = url || <span class="string">&#x27;./images/0.jpeg&#x27;</span>;</span><br><span class="line">        img.<span class="property">crossOrigin</span> = <span class="string">&#x27;anonymous&#x27;</span></span><br><span class="line">        img.<span class="property">onload</span> = <span class="function">() =&gt;</span> &#123;</span><br><span class="line">            <span class="comment">// 在 WebGL 里创建一个 texture</span></span><br><span class="line">            <span class="keyword">let</span> texture = gl.<span class="title function_">createTexture</span>();</span><br><span class="line">            textureList.<span class="title function_">push</span>(texture)</span><br><span class="line">            gl.<span class="title function_">bindTexture</span>(gl.<span class="property">TEXTURE_2D</span>, texture);</span><br><span class="line">            gl.<span class="title function_">activeTexture</span>(gl.<span class="property">TEXTURE0</span> + index);</span><br><span class="line">            gl.<span class="title function_">bindTexture</span>(gl.<span class="property">TEXTURE_2D</span>, textureList[index])</span><br><span class="line">            gl.<span class="title function_">pixelStorei</span>(gl.<span class="property">UNPACK_FLIP_Y_WEBGL</span>, <span class="literal">true</span>);</span><br><span class="line">            gl.<span class="title function_">texImage2D</span>(gl.<span class="property">TEXTURE_2D</span>, <span class="number">0</span>, gl.<span class="property">RGBA</span>, gl.<span class="property">RGBA</span>, gl.<span class="property">UNSIGNED_BYTE</span>, img);</span><br><span class="line">            <span class="keyword">if</span> (<span class="title function_">isPowerOf2</span>(img.<span class="property">width</span>) &amp;&amp; <span class="title function_">isPowerOf2</span>(img.<span class="property">height</span>)) &#123;</span><br><span class="line">                gl.<span class="title function_">generateMipmap</span>(gl.<span class="property">TEXTURE_2D</span>);</span><br><span class="line">            &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;非2的整数次方&quot;</span>);</span><br><span class="line">                gl.<span class="title function_">texParameteri</span>(gl.<span class="property">TEXTURE_2D</span>, gl.<span class="property">TEXTURE_WRAP_S</span>, gl.<span class="property">CLAMP_TO_EDGE</span>);</span><br><span class="line">                gl.<span class="title function_">texParameteri</span>(gl.<span class="property">TEXTURE_2D</span>, gl.<span class="property">TEXTURE_WRAP_T</span>, gl.<span class="property">CLAMP_TO_EDGE</span>);</span><br><span class="line">                gl.<span class="title function_">texParameteri</span>(gl.<span class="property">TEXTURE_2D</span>, gl.<span class="property">TEXTURE_MIN_FILTER</span>, gl.<span class="property">LINEAR</span>);</span><br><span class="line">                gl.<span class="title function_">texParameteri</span>(gl.<span class="property">TEXTURE_2D</span>, gl.<span class="property">TEXTURE_MAG_FILTER</span>, gl.<span class="property">LINEAR</span>);</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">            <span class="title function_">resolve</span>(texture)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
    </div>

    
    
    
      
  <div class="popular-posts-header">相关博客</div>
  <ul class="popular-posts">
    <li class="popular-posts-item">
        <div class="popular-posts-date">2022-09-08</div>
      <div class="popular-posts-title"><a href="webgl实现ps混合模式第三章-强光-柔光-亮光-点光-线性光-实色混合-排除-差值-相加-减法/" rel="bookmark">webgl实现ps混合模式第三章-强光,柔光,亮光,点光,线性光,实色混合,排除,差值</a></div>
      
    </li>
  </ul>


    <footer class="post-footer">
          <div class="reward-container">
  <div></div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/wechatpay.png" alt="wxb 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="/images/alipay.png" alt="wxb 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          <div class="followme">
  <span>欢迎关注我的其它发布渠道</span>

  <div class="social-list">

      <div class="social-item">
        <a target="_blank" class="social-link" href="/atom.xml">
          <span class="icon">
            <i class="fa fa-rss"></i>
          </span>

          <span class="label">RSS</span>
        </a>
      </div>
  </div>
</div>

          <div class="post-tags">
              <a href="/tags/WebGl/" rel="tag"># WebGl</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/C-%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%866-%E7%BB%93%E6%9E%84%E4%BD%93/" rel="prev" title="C++ 基础知识(6)--结构体">
                  <i class="fa fa-chevron-left"></i> C++ 基础知识(6)--结构体
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/webgl%E5%AE%9E%E7%8E%B0ps%E6%B7%B7%E5%90%88%E6%A8%A1%E5%BC%8F%E7%AC%AC%E4%BA%8C%E7%AB%A0-%E5%8F%98%E6%9A%97%E3%80%81%E5%8F%98%E4%BA%AE%E3%80%81%E9%A2%9C%E8%89%B2%E5%8A%A0%E6%B7%B1%E3%80%81%E9%A2%9C%E8%89%B2%E7%AE%80%E5%8D%95%E3%80%81%E7%BA%BF%E6%80%A7%E5%8A%A0%E6%B7%B1%E3%80%81%E7%BA%BF%E6%80%A7%E5%87%8F%E6%B7%A1/" rel="next" title="webgl实现ps混合模式第二章-变暗、变亮、颜色加深、颜色简单、线性加深、线性减淡">
                  webgl实现ps混合模式第二章-变暗、变亮、颜色加深、颜色简单、线性加深、线性减淡 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments gitalk-container"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">wxb</span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <!-- <span id="busuanzi_value_site_uv"></span> -->
        <span id="uv-views"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <!-- <span id="busuanzi_value_site_pv"></span> -->
        <span id="pv-views"></span>
      </span>
    </span>
</div><script src="/js/diy_footer.js"></script>
  <div class="powered-by">
    <div style="display: inline-flex;align-items: center;">
      <img src="/images/copyrihgt.png" alt="wxb 微信" with='20' height='20' style="margin-right: 4px;">
      <a href="https://beian.miit.gov.cn/" target="_blank">浙ICP备2022027687号</a>
    </div>
  </div>

    </div>
  </footer>

  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.5.0/pjax.min.js" integrity="sha256-3NkoLDrmHLTYj7csHIZSr0MHAFTXth7Ua/DDt4MRUAg=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/medium-zoom/1.0.6/medium-zoom.min.js" integrity="sha256-EdPgYcPk/IIrw7FYeuJQexva49pVRZNmt3LculEr7zM=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  
<script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.0/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>





  
  <script data-pjax async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.7.2/gitalk.css" integrity="sha256-AJnUHL7dBv6PGaeyPQJcgQPDjt/Hn/PvYZde1iqfp8U=" crossorigin="anonymous">

<script class="next-config" data-name="gitalk" type="application/json">{"enable":true,"github_id":"dearDreamWeb","repo":"blogwxb.github.io","client_id":"86685a6104f8e6ba5827","client_secret":"7cf015e84bbe755bde20c8aca767977e316304ad","admin_user":"dearDreamWeb","distraction_free_mode":true,"proxy":"https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token","language":"zh-CN","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.7.2/gitalk.min.js","integrity":"sha256-Pmj85ojLaPOWwRtlMJwmezB/Qg8BzvJp5eTzvXaYAfA="},"path_md5":"fe62dcb9b398531f6dd1db6888dc4ea8"}</script>
<script src="/js/third-party/comments/gitalk.js"></script>

</body>
</html>
